Skip to content

Specialize setindex! for VectorOfArray{StructArray}#425

Merged
ChrisRackauckas merged 2 commits intoSciML:masterfrom
jlchan:jc/VoA_StructArray_setindex
Mar 14, 2025
Merged

Specialize setindex! for VectorOfArray{StructArray}#425
ChrisRackauckas merged 2 commits intoSciML:masterfrom
jlchan:jc/VoA_StructArray_setindex

Conversation

@jlchan
Copy link
Copy Markdown
Contributor

@jlchan jlchan commented Mar 14, 2025

Addresses SciML/OrdinaryDiffEq.jl#2625 (comment)

The issue is that VectorOfArray indexing will not mutate a VectorOfArray{StructArray} due to the way StructArrays treats assignment: https://juliaarrays.github.io/StructArrays.jl/stable/counterintuitive/#Modifying-a-field-of-a-struct-element. For example:

u = VectorOfArray(StructArray{MVector{1, Float64}}(ntuple(_ -> [1.0, 2.0], 1)))
u[1,1] = 100
@show u[1,1] # this is still 1.0

@jlchan
Copy link
Copy Markdown
Contributor Author

jlchan commented Mar 14, 2025

I don't think Downgrade and Format CI failures are related to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants